server {
    listen 443 ssl reuseport;
    listen [::]:443 ssl;
    server_name {{ api }};
    client_max_body_size 300M;
    ssl_certificate {{ fullchain_dest }};
    ssl_certificate_key {{ privkey_dest }};

    location /assets/ {
        internal;
        add_header "Access-Control-Allow-Origin" "http://{{ rmm }}:8000";
        alias {{ assets_dir }}/;
    }

    location ~ ^/natsws {
        proxy_pass http://127.0.0.1:9235;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
